﻿using UnityEngine;

/// <summary>
/// 技能动作类。技能行为统一在此调用
/// </summary>
public static partial class SkillAction // data 数据相关
{
    /// <summary>
    /// 造成伤害
    /// </summary>
    public static void DealDamage(UnitEntityBase source, UnitEntityBase target, double skillRate)
    //public static void DealDamage(UnitEntityBase source, UnitEntityBase target, double damage, DamageType type = DamageType.Damage)
    {
        var damage = skillRate * 0.01d;
        target.attribute.currentHP -= (int)damage;
        target.fsm.parameters.SetParam("hurtAxis", source.animator.direction.x);
        FloatDamageNumber.Spawn(damage, target);
    }
    public enum DamageType
    {
        Damage,
        Loss
    }

    /// <summary>
    /// 设置怪物仇恨
    /// </summary>
    public static void SetHated(UnitEntityBase monster, UnitEntityBase target)
    {
        if (monster is MonsterEntity)
        {
            (monster as MonsterEntity).hatred = target;
        }
    }

}